/*
package com.cykj.web.controller.posbiz;


import com.cykj.common.core.controller.BaseController;
import com.cykj.pos.controller.TestDTO.FileItem;
import com.cykj.pos.controller.TestDTO.HttpClientHandler;
import com.cykj.pos.util.PublicUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.logging.Logger;

*/
/**
 * 终端设备信息Controller
 *
 * @author ruoyi
 * @date 2021-04-10
 *//*

@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
public class TestDTOController extends BaseController {
    public static void main(String[] args) {

        TestDTOController testDTOController = new TestDTOController();
        testDTOController.startup();
        testDTOController.startmerchants();
        testDTOController.startselect();
        testDTOController.startupdata();
        testDTOController.startbinding();
        testDTOController.startlist();

    }
    public void startup(){
        System.out.println("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111、统一商户入件（新增、待完善和审核失败）");
        String url="http://175.170.135.195:6090/vipf/merchantinfo.do?action=handleAction&beanName=merchantinfoDao&Methods=add";
        Map<String,String> data = new HashMap<String, String>();
        data.put("phone","103043000950");
        data.put("applicant","王宪峰");
        data.put("provinceno","100813");
        data.put("cityno","100823");
        data.put("areano","100833");
        data.put("certificateno","230281197409021733");
        data.put("certificatestartdate","20180612");
        data.put("certificateenddate","20210823");
        data.put("bankcardaccount","6217992210004531272");
        data.put("fee_chl_id","10271");
        data.put("mersource","OUTMER");
        data.put("agentid","35642");
        data.put("sign","jdfik0");
        String merPath = "E:\\壁纸";
        System.out.println(data);
        File[] files = PublicUtil.getCurFilesList(merPath);

        System.out.println("merpicImglist-merPath:"+merPath);

        Map<String, FileItem> fileItemMap = new HashMap<>();
        try{
            if(files == null ||files.length == 0){
                System.out.println("无图片");
            }else{
                System.out.println("fileslength:"+files.length);

                for(File file:files){

                    String filename = file.getName();
                    String key = "";
                    if(filename.lastIndexOf(".")>-1){
                        key = filename.substring(0,filename.lastIndexOf("."));//文件不带后缀
                        System.out.println("key-----"+key);
                    }else{
                        key = "";
                    }
                    String filepath = merPath+File.separator+filename;;
                    fileItemMap.put(key, new FileItem(filename, new File(filepath)));
                }
            }
        } catch (Exception e) {
            System.out.println("图片错误异常");
        }
        String result = HttpClientHandler.onRequest(url, data, fileItemMap);
        System.out.println("返回:"+result);
    }
    public void startmerchants(){
        System.out.println("222222222222222222222222222222222222222222222222222222222222222222222222222、商户列表");
        String url="http://175.170.135.195:6090/vipf/merchantinfo.do?action=handleAction&beanName=merchantinfoDao&Methods=list";
        Map<String,String> data = new HashMap<String, String>();
        data.put("account_id","103043000950");
        data.put("mer_info","王宪峰");
        data.put("provinceno","20190612");
        data.put("merstart","2");
        data.put("start","5");
        data.put("limit","25");
        data.put("mersource","OUTMER");
        data.put("agentid","20210823");
        data.put("sign","sdoop");
        String merPath = "E:\\壁纸";
        System.out.println(data);
        File[] files = PublicUtil.getCurFilesList(merPath);

        System.out.println("merpicImglist-merPath:"+merPath);

        Map<String, FileItem> fileItemMap = new HashMap<>();
        try{
            if(files == null ||files.length == 0){
                System.out.println("无图片");
            }else{
                System.out.println("fileslength:"+files.length);

                for(File file:files){

                    String filename = file.getName();
                    String key = "";
                    if(filename.lastIndexOf(".")>-1){
                        key = filename.substring(0,filename.lastIndexOf("."));//文件不带后缀
                        System.out.println("key-----"+key);
                    }else{
                        key = "";
                    }
                    String filepath = merPath+File.separator+filename;;
                    fileItemMap.put(key, new FileItem(filename, new File(filepath)));
                }
            }
        } catch (Exception e) {
            System.out.println("图片错误异常");
        }
        String result = HttpClientHandler.onRequest(url, data, fileItemMap);
        System.out.println("返回:"+result);
    }
    public void startselect(){
        System.out.println("33333333333333333333333333333333333333333333333333333333333333333333333333、商户信息查询");
        String url="http://175.170.135.195:6090/vipf/merchantinfo.do?action=handleAction&beanName=merchantinfoDao&Methods=load";
        Map<String,String> data = new HashMap<String, String>();
        data.put("merchant_no","100000000000111");
        data.put("mersource","OUTMER");
        data.put("agentid","20210824");
        data.put("sign","sdoopsd");
        String merPath = "E:\\壁纸";
        System.out.println(data);
        File[] files = PublicUtil.getCurFilesList(merPath);

        System.out.println("merpicImglist-merPath:"+merPath);

        Map<String, FileItem> fileItemMap = new HashMap<>();
        try{
            if(files == null ||files.length == 0){
                System.out.println("无图片");
            }else{
                System.out.println("fileslength:"+files.length);

                for(File file:files){

                    String filename = file.getName();
                    String key = "";
                    if(filename.lastIndexOf(".")>-1){
                        key = filename.substring(0,filename.lastIndexOf("."));//文件不带后缀
                        System.out.println("key-----"+key);
                    }else{
                        key = "";
                    }
                    String filepath = merPath+File.separator+filename;;
                    fileItemMap.put(key, new FileItem(filename, new File(filepath)));
                }
            }
        } catch (Exception e) {
            System.out.println("图片错误异常");
        }
        String result = HttpClientHandler.onRequest(url, data, fileItemMap);
        System.out.println("返回:"+result);
    }
    public void startupdata(){
        System.out.println("4444444444444444444444444444444444444444444444444444444444444444444444444444、商户信息修改(审核成功后结算修改)");
        String url="http://175.170.135.195:6090/vipf/merchantinfo.do?action=handleAction&beanName=merchantinfoDao&Methods=update";
        Map<String,String> data = new HashMap<String, String>();
        data.put("merchant_no","100000000000111");
        data.put("account_id","103043000950");
        data.put("provinceno","100813");
        data.put("cityno","100823");
        data.put("areano","100833");
        data.put("certificateno","222426199901243269");
        data.put("certificatestartdate","20180612");
        data.put("certificateenddate","20210823");
        data.put("bankcardaccount","6217992210004531272");
        data.put("fee_chl_id","438");
        data.put("mersource","OUTMER");
        data.put("agentid","35642");
        data.put("sign","jdfik0");
        String merPath = "E:\\壁纸";
        System.out.println(data);
        File[] files = PublicUtil.getCurFilesList(merPath);

        System.out.println("merpicImglist-merPath:"+merPath);

        Map<String, FileItem> fileItemMap = new HashMap<>();
        try{
            if(files == null ||files.length == 0){
                System.out.println("无图片");
            }else{
                System.out.println("fileslength:"+files.length);

                for(File file:files){

                    String filename = file.getName();
                    String key = "";
                    if(filename.lastIndexOf(".")>-1){
                        key = filename.substring(0,filename.lastIndexOf("."));//文件不带后缀
                        System.out.println("key-----"+key);
                    }else{
                        key = "";
                    }
                    String filepath = merPath+File.separator+filename;;
                    fileItemMap.put(key, new FileItem(filename, new File(filepath)));
                }
            }
        } catch (Exception e) {
            System.out.println("图片错误异常");
        }
        String result = HttpClientHandler.onRequest(url, data, fileItemMap);
        System.out.println("返回:"+result);
    }
    public void startbinding(){
        System.out.println("555555555555555555555555555555555555555555555555555555555555555555555555555、商户绑定终端");
        String url="http://175.170.135.195:6090/vipf/merchantinfo.do?action=handleAction&beanName=terminalinfoDao&Methods=add";
        Map<String,String> data = new HashMap<String, String>();
        data.put("merchant_no","100000000000111");
        data.put("sn","G20045W2280");
        data.put("mersource","OUTMER");
        data.put("agentid","35642");
        data.put("sign","jdfik0");
        String merPath = "E:\\壁纸";
        System.out.println(data);
        File[] files = PublicUtil.getCurFilesList(merPath);

        System.out.println("merpicImglist-merPath:"+merPath);

        Map<String, FileItem> fileItemMap = new HashMap<>();
        try{
            if(files == null ||files.length == 0){
                System.out.println("无图片");
            }else{
                System.out.println("fileslength:"+files.length);

                for(File file:files){

                    String filename = file.getName();
                    String key = "";
                    if(filename.lastIndexOf(".")>-1){
                        key = filename.substring(0,filename.lastIndexOf("."));//文件不带后缀
                        System.out.println("key-----"+key);
                    }else{
                        key = "";
                    }
                    String filepath = merPath+File.separator+filename;;
                    fileItemMap.put(key, new FileItem(filename, new File(filepath)));
                }
            }
        } catch (Exception e) {
            System.out.println("图片错误异常");
        }
        String result = HttpClientHandler.onRequest(url, data, fileItemMap);
        System.out.println("返回:"+result);
    }
    public void startlist(){
        System.out.println("66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666、商户终端列表");
        String url="http://175.170.135.195:6090/vipf/merchantinfo.do?action=handleAction&beanName=terminalinfoDao&Methods=list";
        Map<String,String> data = new HashMap<String, String>();
        data.put("mer_info","王宪峰");
        data.put("provinceno","20210822");
        data.put("sn","G20045W2280");
        data.put("start","2");
        data.put("limit","25");
        data.put("mersource","OUTMER");
        data.put("agentid","20210823");
        data.put("sign","sdoop");
        String merPath = "E:\\壁纸";
        System.out.println(data);
        File[] files = PublicUtil.getCurFilesList(merPath);

        System.out.println("merpicImglist-merPath:"+merPath);

        Map<String, FileItem> fileItemMap = new HashMap<>();
        try{
            if(files == null ||files.length == 0){
                System.out.println("无图片");
            }else{
                System.out.println("fileslength:"+files.length);

                for(File file:files){

                    String filename = file.getName();
                    String key = "";
                    if(filename.lastIndexOf(".")>-1){
                        key = filename.substring(0,filename.lastIndexOf("."));//文件不带后缀
                        System.out.println("key-----"+key);
                    }else{
                        key = "";
                    }
                    String filepath = merPath+File.separator+filename;;
                    fileItemMap.put(key, new FileItem(filename, new File(filepath)));
                }
            }
        } catch (Exception e) {
            System.out.println("图片错误异常");
        }
        String result = HttpClientHandler.onRequest(url, data, fileItemMap);
        System.out.println("返回:"+result);
    }
    public static String generateSignature(Map<String, String> data) throws Exception {

        Set<String> keySet = data.keySet();
        String[] keyArray = keySet.toArray(new String[keySet.size()]);
        Arrays.sort(keyArray);
        StringBuilder sb = new StringBuilder();

        for(int i=0;i<keyArray.length;i++){
            String k = keyArray[i];
            if (data.get(k).trim().length() > 0){ // 参数值为空，则不参与签名
                sb.append(k).append("=").append(data.get(k).trim());

                if(i!=keyArray.length-1){
                    sb.append("&");
                }

            }

        }

        System.out.println("SIGNSTR:"+sb.toString());
        return md5(sb.toString()).toUpperCase();

    }

    */
/*
     * 方法描述:将字符串MD5加码 生成32位md5码
     *
     * @author leon 2016年10月10日 下午3:02:30
     * @param inStr
     * @return
     *//*

    public static String md5(String inStr) {
        try {
            return DigestUtils.md5Hex(inStr.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("MD5签名过程中出现错误");
        }
    }
}
*/
